Use Python installer from the https://www.python.org/#38
Use Python installer from the https://www.python.org/#38ader1990 wants to merge 1 commit intocloudbase:masterfrom
Conversation
To avoid always writing the Python installation files to this folder, we can just download the installer, check the SHA1 checksum and install Python. This way, on the next Python version iteration, we can just change the SHA1 checksum dictionary and the build can be done. Signed-off-by: Adrian Vladu <avladu@cloudbasesolutions.com>
69770ce to
7e9acb4
Compare
| [string]$platform = "x64", | ||
| [string]$pythonversion = "3.11_9", | ||
| [string]$pythonversion = "3.12.3", | ||
| [string]$pythonversionPrelease = "", |
There was a problem hiding this comment.
I assume Prelease stands for pre-release (e.g. b1, a6, etc), we could add a comment.
There was a problem hiding this comment.
Will fix the name, it s a typo
|
|
||
| try { | ||
| Write-Host "Trying to uninstall Python ${pythonVersionInstaller} to ${python_template_dir}" | ||
| $installProcess = Start-Process -PassThru -Wait $pythonInstallerPath ` |
There was a problem hiding this comment.
I'm a bit concerned about removing existing Python installations, it might mess someone's dev environment.
Instead of uninstalling/installing Python, can we use the "embeddable" zip archives?
e.g. https://www.python.org/ftp/python/3.12.3/python-3.12.3-embed-amd64.zip
There was a problem hiding this comment.
I was thinking about the embed version too, but it is not that straightforward. The embeded Python is a subset of Python with less features, and we will need to navigate the dependency graph to install the required parts (pip, setuptools and maybe others). You will end up making the required parts of an installer, but with extra steps and without any SHA1 verifiable start point.
There was a problem hiding this comment.
I have also made a branch with the Embedded version. There are a few things to be aware of the embedded version though as it is not suitable to build CPYTHON extensions:
- Include folder does not exist
- Python.lib files do not exist
- pyconfig.h does not exist
The include folder can be downloaded from the github cpython repository.
Python.lib files can be built from cpython source code or gotten from the MSI installer installation directory, same with pyconfig.h.
If the wheels are already available from pypi, the Embedded version will work without these requirements.
There was a problem hiding this comment.
So by getting rid of netifaces, we should be able to easily use the embeddable version. We'd have to do that anyway, since it's no longer maintained.
We can't use wmi because the provider is not available at that stage. What we could do would be to implemented an utils module that calls the following using ctypes: https://github.com/al45tair/netifaces/blob/53fcdb6e5dccc84f6734939cfee1a95d3f470d7b/netifaces.c#L1304
To avoid always writing the Python installation files to this folder, we can just download the installer, check the SHA1 checksum and install Python.
This way, on the next Python version iteration, we can just change the SHA1 checksum dictionary and the build can be done.